//
//  MKSubpageCollectionViewCell.m
//  ManKeCartoon
//
//  Created by dllo on 15/10/21.
//  Copyright © 2015年 ManKe. All rights reserved.
//

#import "MKSubpageCollectionViewCell.h"

@implementation MKSubpageCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.rankImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10*WIDTH, 7, SCREEN_WIDTH / 4, SCREEN_WIDTH / 3)];
        [self.contentView addSubview:_rankImageView];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15*WIDTH, self.rankImageView.frame.size.height + 12, self.rankImageView.frame.size.width+10, 20)];
        [self.titleLabel setFont:[UIFont systemFontOfSize:14]];
        [self.titleLabel setTextColor:[UIColor blackColor]];
        [self.contentView addSubview:self.titleLabel];
        
        self.lastupLabel = [[UILabel alloc] initWithFrame:CGRectMake(15*WIDTH, self.titleLabel.frame.origin.y + 25, self.titleLabel.frame.size.width, 20)];
        [self.lastupLabel setFont:[UIFont systemFontOfSize:13]];
        [self.lastupLabel setTextColor:[UIColor grayColor]];
        [self.contentView addSubview:self.lastupLabel];
        
        self.rankLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.rankImageView.frame.size.width / 3 * 2, self.rankImageView.frame.size.height - self.rankImageView.frame.size.width / 3, self.rankImageView.frame.size.width / 3, self.rankImageView.frame.size.width / 3)];
        [self.rankLabel setFont:[UIFont boldSystemFontOfSize:25]];
        if (SCREEN_HEIGHT != 667) {
            [self.rankLabel setFont:[UIFont boldSystemFontOfSize:22]];
        }
        [self.rankLabel setTextColor:[UIColor whiteColor]];
        [self.rankLabel setTextAlignment:NSTextAlignmentCenter];
        [self.rankImageView addSubview:self.rankLabel];
        
        

    }
    return self;
}

-(void)getcell:(MKChartsModel *)model
{
    self.rankLabel.text = model.title;
    
    self.lastupLabel.text = [NSString stringWithFormat:@"更新到%@",model.lastup];
    
    self.titleLabel.text = model.title;
    
    NSURL *url = [NSURL URLWithString:model.cover_url];
    [self.rankImageView sd_setImageWithURL:url];
    
}





@end
